# List of plugins
# set -g @plugin 'tmux-plugins/tpm'
# set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g @plugin 'seebi/tmux-colors-solarized'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
# run '~/.tmux/plugins/tpm/tpm'

# set -g @colors-solarized 'dark'

# status bar
set-option -g status-utf8 on

# 默认使用zsh
set -g default-shell /bin/zsh

#  每秒更新一下状态栏
set -g status-interval 1

# 设置窗口列表在状态栏的中部
set -g status-justify centre

set -g status-left-length 20
set -g status-right-length 140

# 状态栏左右清空
# set -g status-left ''
# set -g status-right ''
set -g status-left '#[fg=green]#H #[fg=black]• #[fg=green,bright]#(uname -r | cut -c 1-6)#[default]'
set -g status-right '#[fg=green,bg=black,bright]#(tmux-mem-cpu-load 1) #[fg=red,dim]#(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") #[fg=white]%a%l:%M:%S %p#[default] #[fg=blue]%Y-%m-%d'

# 设置状态栏的颜色
set -g status-fg white
set -g status-bg default
set -g status-attr bright

# 设置默认窗口标题的颜色
set-window-option -g window-status-fg white
set-window-option -g window-status-bg default
set-window-option -g window-status-attr dim

# 设置激活窗口的标题颜色
set-window-option -g window-status-current-fg red
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-attr bright

# 更换c-b前缀键
set-option -g prefix C-a
bind-key C-a last-window

# 设置其实编号为1
set -g base-index 1

# Allows for faster key repetition
set -s escape-time 0

# 自动适配窗口大小
setw -g aggressive-resize on

# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
bind-key a send-prefix

# 当其他窗口发生事件的时候，状态栏提醒
setw -g monitor-activity on
set -g visual-activity on

# 高亮当前激活的窗口
set-window-option -g window-status-current-bg green

# Highlight active pane
set-option -g pane-active-border-fg green

# Vi 复制模式
set-window-option -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection

# hjkl pane traversal
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# 重新加载配置文件
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."

# auto window rename
set-window-option -g automatic-rename

# color
set -g default-terminal "screen-256color"

# + and - now "zoom" in and out of a pane (e.i., temporarily maximize it)
unbind +
bind + new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \; swap-pane -s tmux-zoom.0 \; select-window -t tmux-zoom
unbind -
bind - last-window \; swap-pane -s tmux-zoom.0 \; kill-window -t tmux-zoom

# | and _ are now used for splitting windows into panes
unbind %
bind | split-window -h
bind _ split-window -v

# 复制系统前切板信息到tmux中
bind C-v run "xclip -o | tmux load-buffer - ; tmux paste-buffer" \; display-message "Copied from OS clipboard"

# make tmux copy also copy into OS clipboard
# details: http://unix.stackexchange.com/a/131187
bind -t vi-copy y copy-pipe 'xclip -in -selection clipboard'

# 当有窗口关闭的时候自动编号
set -g renumber-windows on
